package org.nfyszny.zzzs.modules.controller;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.vo.OperateReportVo;
import org.nfyszny.zzzs.modules.service.IZzzsReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;


@RestController
@RequestMapping("/modules/zzzsReport")
@Slf4j
@ApiOperation("报表")
public class ZzzsReportController {
    @Autowired
    private IZzzsReportService reportService;

    @GetMapping("operateYearReport")

    public Result operateYearReport(@RequestParam(value = "date", required = false) String year) throws ParseException {

        List<OperateReportVo> list = reportService.operateReport(year);
        return Result.TOK(list);
    }

    @GetMapping("operateQuarteReport")

    public Result operateQuarteReport(@RequestParam(value = "date", required = false) String quarte) throws ParseException {
        List<OperateReportVo> list = reportService.operateQuarteReport(quarte);
        return Result.TOK(list);
    }

    @GetMapping("operatMonthReport")

    public Result operatMonthReport(@RequestParam(value = "date", required = false) String month) throws ParseException {
        List<OperateReportVo> list = reportService.operateMonthReport(month);
        return Result.TOK(list);
    }



    @GetMapping("yearReport")
    @ApiOperation("年度报表")
    public Result yearReport(@RequestParam(value = "date", required = false) String year) throws ParseException {

        List<OperateReportVo> list = reportService.operateReport(year);
        return Result.TOK(list);
    }

    @GetMapping("quarteReport")
    @ApiOperation("季度报表")
    public Result quarteReport(@RequestParam(value = "date", required = false) String quarte) throws ParseException {
        List<OperateReportVo> list = reportService.operateQuarteReport(quarte);
        return Result.TOK(list);
    }

    @GetMapping("monthReport")
    @ApiOperation("月份报表")
    public Result monthReport(@RequestParam(value = "date", required = false) String month) throws ParseException {
        List<OperateReportVo> list = reportService.operateMonthReport(month);
        return Result.TOK(list);
    }
}
